<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <!--{include file='comm/header.tpl'}-->
    <title>个人设置</title>
</head>
<body>
<!--{include file='comm/naviBanner.tpl'}-->

<div style="width:100%">

    <!--{include file='comm/menu.tpl'}-->

    <div class="comm_right">

        <div class="comm_crub">
            <span class="now_crub">个人设置</span>
        </div>

        <form id="user_form" onsubmit="return false;">

            <div class="items2"  style="margin-left: 10px;">

                <table>
                    <tr>
                        <td>

                            <div class="input-group input-group-lg">
                                <span class="input-group-addon">用户名：</span>
                                <input type="text" class="form-control" readonly="readonly" value="<!--{$user_array.userID}-->" id="userID" name="userID" />
                            </div>

                            <div class="input-group input-group-lg">
                                <span class="input-group-addon">用户姓名：</span>
                                <input type="text" class="form-control" placeholder="用户姓名 【必填】" value="<!--{$user_array.trueName}-->" id="trueName" name="trueName" />
                            </div>

                            <div class="input-group input-group-lg">
                                <span class="input-group-addon">密码：</span>
                                <input type="password" class="form-control" placeholder="密码 【为空时不修改】"  id="userPwd" name="userPwd" />
                            </div>

                            <div class="input-group input-group-lg">
                                <span class="input-group-addon">密码：</span>
                                <input type="password" class="form-control" placeholder="密码确认 "  id="repeatPwd" name="repeatPwd" />
                            </div>

                            <div class="input-group input-group-lg">
                                <span class="input-group-addon">email：</span>
                                <input type="text" class="form-control" placeholder="email 【必填】" value="<!--{$user_array.email}-->"  id="email" name="email" />
                            </div>

                        </td>
                    </tr>

                </table>
            </div>

        </form>

    </div>

    <div class="bottom_fixbox">

        <div class="rectbox tac">
            <input type="button" class="btn" onclick="user.check();" value="保存" />&nbsp;&nbsp;&nbsp;
        </div>

    </div>

    <!--{include file='comm/footer.tpl'}-->

</div>

<script type="text/javascript">

    var user = {

        dt: "",

        check: function() {

            this.dt = E.getFormValues("user_form");
            var error_msg = "";

            if (E.isEmpty(this.dt.trueName)) {
                error_msg += "用户姓名不能为空<br>";
            }
            if (!E.isEmpty(this.dt.userPwd)) {

                if (!E.isPwd(this.dt.userPwd)) {
                    error_msg += "输入的密码格式错误<br>";
                } else if (this.dt.userPwd != this.dt.repeatPwd) {
                    error_msg += "两次输入的密码不一致<br>";
                }

            }
            if (!E.isEmail(this.dt.email)) {
                error_msg += "电子邮件不能为空或格式错误<br>";
            }

            if (error_msg != "") {
                E.alert(error_msg);
            } else {
                E.confirm("您确认要修改个人信息吗？", "user.edit");
            }

        },

        edit: function() {

            E.loadding.open("正在修改个人信息，请稍候...");
            E.ajax_post({
                url: "/invokingAjax-backend/user/userList.ajax?operFlg=6&xjx=none",
                data: this.dt,
                call: "user.result"
            });

        },

        result: function( o ) {

            E.loadding.close();
            if (o.code == 200) {
                E.alert(o.message, 2, "user.location")
            } else {
                E.alert(o.message);
            }

        },

        location: function() {
            self.location = "/quanliadmin";
        }

    };

</script>

</body>
</html>